import { useState } from 'react';
import { createPortal } from 'react-dom';
import { CustomModalContent } from './CustomModalContent';

export const CustomModal = () => {
  const [showModal, setShowModal] = useState(false);
  return (
    <>
      <button onClick={() => setShowModal(true)}>Open</button>
      {showModal &&
        createPortal(<CustomModalContent onClose={() => setShowModal(false)} />, document.body)}
    </>
  );
};
